﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace igflow
{
    public static class World
    {
        public static  GraphicsDeviceManager Graphics;
        public static ContentManager contentManager;
        public static Camera currentCamera;
        public static void Init(GraphicsDeviceManager device, ContentManager content)
        {
            Graphics = device;
            contentManager = content;

            // Initialize static classes
            Scene = new Scene();
            Scene.Init();
            Fonts.Init(contentManager);
            GUI.Init(Graphics.GraphicsDevice);

            CameraManager.Init();

        }

        public static void AddGameObject(GameObject.igGameObject gameObject)
        {
            Scene.AddGameObject(gameObject);
        }

        public static List<GameObject.igGameObject> FindObjects(Type type)
        {
            List<GameObject.igGameObject> returnList = new List<igflow.GameObject.igGameObject>();
            foreach (GameObject.igGameObject gameObject in Scene.gameObjects)
            {
                if (gameObject.GetType() == type)
                {
                    returnList.Add(gameObject);
                }
            }
            return returnList;
        }

        public static Scene Scene;
        public static void Update()
        {
            Graphics.GraphicsDevice.Clear(Color.DarkGray);
            currentCamera = CameraManager.MainCamera;
            Input.Update();
            Scene.Update();
        }
    }
}
